<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class WaterBill extends Model
{
    public $timestamps = false;
    protected $connection = 'mysql_center';
    protected $table = 'electric_electricity_bill';

    //关联用户
    public function owner()
    {
        return $this->hasOne(ElectricPlatformOwner::class, 'id', 'owner_id');
    }

    //关联电表
    public function ele()
    {
        return $this->hasOne(ElectricElectricity::class, 'id', 'electric_id');
    }

    //关联区域
    public function community()
    {
        return $this->hasOneThrough(ElectricCommunity::class, ElectricPlatformOwner::class, 'id', 'id', 'owner_id', 'community');
    }
}
